<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="http://struts.apache.org/tags-html-el" prefix="html-el" %>
<%@taglib uri="http://struts.apache.org/tags-bean-el" prefix="bean-el" %>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@taglib uri="/WEB-INF/tld/application.tld" prefix="app" %>

<html-el:form action="/pontoEletronico.do">
	<html-el:hidden property="method" styleId="method"/>
	<table style="width: 100%">
		<tr>
			<td align="center" valign="top">
				<!-- CONTENT -->			
				<div class="content">
					<table class="con">
						<tr>
							<td>
								<table class="breadory">
									<tr>
										<td>Ponto Eletrônico</td>
									</tr>
								</table>
							
								<table style="width:650px">
									<tr>
										<td align="left" valign="top">
											<table style="width:100%">
												<tr>
													<td style="width:30px">Data:</td>
													<td style="width:170px">
														<input type="text" name="de" id="de" value="${PontoEletronicoConsultarForm.de}" title="Data - de" constraints="{datePattern:'dd/MM/yyyy', strict:true}" data-dojo-type="dijit.form.DateTextBox" data-dojo-props="required:true, invalidMessage:'Data Inválida!'"/>
													</td>
													<td style="width:30px">até</td>
													<td style="width:170px">
														<input type="text" name="ate" id="ate" value="${PontoEletronicoConsultarForm.ate}" title="Data - até" constraints="{datePattern:'dd/MM/yyyy', strict:true}" data-dojo-type="dijit.form.DateTextBox" data-dojo-props="required:true, invalidMessage:'Data Inválida!'"/>
													</td>
													<td style="width:60%"></td>
												</tr>
												<logic:equal name="usuario" property="tipo.value" value="1" scope="session">
												<tr>
													<td>Funcionário:</td>
													<td>
														<app:comboFuncionario styleId="funcionario" title="Funcionário" loginOnly="true" style="width:250px"/>
													</td>
												</tr>
												</logic:equal>
												<tr>
													<td class="buttons" align="right" valign="bottom" colspan="5">	
														<a href="javascript:consultar()" class="button">
															<span>Consultar</span>
														</a>
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td style="height:10px"></td>
									</tr>
									<tr>
										<td valign="top">
											<table style="width: 100%" class="tbDadosConsulta">
												<tr>
													<th style="width:25px"></th>
													<th style="width:90px">Data</th>
													<th style="width:110px">Dia</th>
													<th style="width:90px">Entrada</th>
													<th style="width:90px">Saída</th>
													<th style="width:90px">Total</th>
												</tr>
												<logic:present name="listaResultado" scope="request">
													<logic:iterate id="bean" name="listaResultado" scope="request" indexId="i">
														<tr class="linha${i%2}">
															<td style="text-align: center">
																<logic:equal name="usuario" property="tipo.value" value="1" scope="session">
																	<html-el:radio property="idSelecionado" value="${bean.codigo}" onclick="selectItem(this)"/>
																</logic:equal>
																<logic:notEqual name="usuario" property="tipo.value" value="1" scope="session">
																	${i+1}
																</logic:notEqual>
															</td>
															<td style="text-align: center">
																<bean:write name="bean" property="entrada" format="dd/MM/yyyy"/>
															</td>
															<td style="text-align: center">
																<bean:write name="bean" property="entrada" format="EEEE"/>
															</td>
															<td style="text-align: center">
																<bean:write name="bean" property="entrada" format="HH:mm"/>														
															</td>
															<td style="text-align: center">
																<bean:write name="bean" property="saida" format="HH:mm"/>
															</td>
															<td style="text-align: center">${bean.totalHoras}</td>
														</tr>
													</logic:iterate>
													<tr class="linha1"> 
														<td style="text-align: right" colspan="5"><b>Total:</b></td>
														<td style="text-align: center">${totalHoras}</td>
													</tr>
													<tr class="linha2"> 
														<td style="text-align: right" colspan="5"><b>Arredondamento:</b></td>
														<td style="text-align: center">${arredondamento}</td>
													</tr>
													<html-el:hidden property="idSelecionado"/>
												</logic:present>								
											</table>
										</td>
									</tr>
								</table>							
							</td>
						</tr>						
					</table>	
				</div>	
			</td>
		</tr>
	</table>
</html-el:form>
<script language="javascript">

	function consultar() {
		document.forms[0].method.value = "consultar";
		document.forms[0].submit();
	}
	
</script>